﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MWS_AddDirectory.handlers.barcode
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["digits"] != null)
            {
                string codeForBar = Request["digits"];
                Code39Settings settings = new Code39Settings();
                settings.DrawText = true;
                
                Code39 barra = new Code39(codeForBar, settings);

                System.IO.MemoryStream memoria = new System.IO.MemoryStream();
                barra.Paint().Save(memoria, System.Drawing.Imaging.ImageFormat.Png);
                Response.ContentType = "image/png";
                Response.BinaryWrite(memoria.GetBuffer());
            }
        }
    }
}